package com.imon.web.codesphere.data;

import org.codehaus.jackson.annotate.JsonIgnore;

import com.google.code.morphia.annotations.Entity;
import com.google.code.morphia.annotations.Id;

@Entity
public class RepositoryInfo implements Cloneable {

	@Id
	private String svnLocation;

	private String title;
	private long lastRevision;
	private String repositoryUUID;

	private String password;

	private String username;

	public void setLocation(final String anSvnUrl) {
		this.svnLocation = anSvnUrl;
	}

	public String getLocation() {
		return svnLocation;
	}

	public void setLastRevision(final long aRevision) {
		this.lastRevision = aRevision;
	}

	public long getLastRevision() {
		return lastRevision;
	}

	public void setRepositoryUUID(final String aRepositoryUUID) {
		this.repositoryUUID = aRepositoryUUID;
	}

	public String getRepositoryUUID() {
		return repositoryUUID;
	}

	@JsonIgnore
	public String getPassword() {
		return this.password;
	}

	public void setPassword(final String aPassword) {
		this.password = aPassword;
	}

	@JsonIgnore
	public String getUsername() {
		return this.username;
	}

	public void setUsername(final String aUsername) {
		this.username = aUsername;
	}

	public void setRepositoryTitle(final String aTitle) {
		this.title = aTitle;
	}

	public String getRepositoryTitle() {
		return this.title;
	}

	@Override
	public String toString() {
		return "RepositoryInfo [svnLocation=" + svnLocation + ", title=" + title + ", lastRevision=" + lastRevision
				+ ", repositoryUUID=" + repositoryUUID + ", password=" + password + ", username=" + username + "]";
	}

	@Override
	public RepositoryInfo clone() {
		try {
			return (RepositoryInfo) super.clone();
		} catch (final CloneNotSupportedException e) {
			throw new AssertionError();
		}

	}
}